-- written in love-11.3
local Bgm = require "Bgm"
local Bg = require "bg"
local Dialog = require "dialog"
local Parser = require "parser"

current_cmd = ""
current_param = {}
function love.load()
    love.window.setTitle("orange")
    myFont = love.graphics.newFont("puhuiti.ttf",24)
    Parser.to_lines("init.txt")
end

function love.draw()
    love.graphics.setFont(myFont)
    if current_cmd == "@bg" then
        Bg.draw("bg/"..current_param[1],0,0)
    elseif current_cmd == "@bgm" then
        Bgm.load("bgm/"..current_param[1])
        Bgm.play()
    end
end

function love.update(dt)
end




function love.mousereleased(x,y,button,press)
   current_text = Parser.nextLine()
   if Utils.startsWith(current_text,"@") then
    sp = Parser.splitCommandAndParams(current_text)
    current_cmd = sp.command
    current_param = sp.params
    
   end
end